package com.pluginsacceptor.plugin.formula.datetime;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

import com.pluginsacceptor.plugin.formula.MathsTrigo.support.DataListener;
import com.pluginsacceptor.plugin.formula.MathsTrigo.support.DataSender;

public class DateTimeMenu extends JMenu {
	   /** */
    private final DataListener dataListener;

    /** */
    private final DataSender dataSender;

    /**
     *
     */

    private static final long serialVersionUID = -3110316243457377854L;
    public DateTimeMenu(final DataListener dataListener, final DataSender dataSender) {
		super("Dates & Heures");
		this.dataListener = dataListener;
	    this.dataSender = dataSender;
		addItems();
		addListeners();


	}
		JMenuItem month;
		JMenuItem monthValue;
		JMenuItem weekDay;
		JMenuItem dayOfTheMonth;
		JMenuItem dayOfTheYear;
		JMenuItem year;
		JMenuItem minute;
		JMenuItem hour24;
		JMenuItem hour12;
		JMenuItem second;


	private void addItems() {

		month = new JMenuItem("Mois");
		add(month);

		monthValue = new JMenuItem("Mois(Valeur)");
		add(monthValue);

		weekDay = new JMenuItem("Jour");
		add(weekDay);

		dayOfTheMonth = new JMenuItem("Jour(Valeur)");
		add(dayOfTheMonth);

		year = new JMenuItem("Annee");
		add(year);

		dayOfTheYear = new JMenuItem("Jour 355");
		add(dayOfTheYear);


		minute = new JMenuItem("Minute");
		add(minute);

		hour24 = new JMenuItem("Heure(24)");
		add(hour24);

		hour12 = new JMenuItem("Heure(12)");
		add(hour12);

		second = new JMenuItem("Seconde");
		add(second);
	}

	private void addListeners() {

		month.addActionListener(new MonthListenerCalcul(dataListener, dataSender));
		monthValue.addActionListener(new MonthValueListenerCalcul(dataListener, dataSender));
		weekDay.addActionListener(new WeekDayListenerCalcul(dataListener, dataSender));
		dayOfTheMonth.addActionListener(new DayOfTheMonthListenerCalcul(dataListener, dataSender));
		dayOfTheYear.addActionListener(new DayOfTheYearListenerCalcul(dataListener, dataSender));
		year.addActionListener(new YearListenerCalcul(dataListener, dataSender));
		minute.addActionListener(new MinuteListenerCalcul(dataListener, dataSender));
		hour24.addActionListener(new Hour24ListenerCalcul(dataListener, dataSender));
		hour12.addActionListener(new Hour12ListenerCalcul(dataListener, dataSender));
		second.addActionListener(new SecondListenerCalcul(dataListener, dataSender));
	}

}
